<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button type="button" id="button_id">按钮2</button>
<script>
    function myfunc(){
        alert("大家好，我叫张三")
    }
    document.getElementById("button_id").onclick = myfunc
</script>
</body>
</html>